package cn.wp.ewallet.wallet.web.controller;

import cn.wp.common.core.Wp;
import cn.wp.common.core.dto.WpResult;
import cn.wp.common.core.model.WpPage;
import cn.wp.common.core.web.annotation.ClearInterceptor;
import cn.wp.common.core.web.interceptor.LoginInterceptor;
import cn.wp.ewallet.wallet.model.dto.TransAccountLogDto;
import cn.wp.ewallet.wallet.model.dto.TransAccountLogReqDto;
import cn.wp.ewallet.wallet.service.TransAccountLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName TransAccountLogController
 * @Author ruixule
 * @Date 2020/1/8 9:55
 */
@RestController
@RequestMapping(Wp.WebContext + "/ewallet/wallet/transAccount")
@Api(tags = "转账记录")
public class TransAccountLogController {
    @Autowired
    private TransAccountLogService transAccountLogService;

    /**备注前端：
     * 转账记录： 转入、装出  根据from，to 的钱包地址进行判断
     * 充值记录： 只要from 地址为null 表示 充值的进入的
     * 通过钱包地址获取转账 记录
     * @return
     */
    @GetMapping("/getAccountLogs")
    @ApiOperation("获取转账记录")
    public WpResult getAccountLogsByWallet(WpPage wpPage){
        return new WpResult().success(transAccountLogService.getTransAccountLogByWalAdd(wpPage)) ;
    }


    @GetMapping("/getCollectLog")
    @ApiOperation("查询自动归集信息")
    public WpResult getCollectLog(TransAccountLogReqDto transAccountLogReqDto, WpPage wpPage){
        return new WpResult().success(transAccountLogService.getCollectLog(transAccountLogReqDto, wpPage)) ;
    }

    @GetMapping("/getLogById")
    @ApiOperation("根据ID查询转账记录")
    public WpResult getLogById(String logId){
        return new WpResult().success(transAccountLogService.getLogById(logId)) ;
    }

    @GetMapping("getTransAccountLogsInSys")
    @ApiOperation("获取系统内的转账记录")
    public WpResult getTransAccountLogsInSys(TransAccountLogReqDto transAccountParamsDto, WpPage wpPage){
        return new WpResult().success(transAccountLogService.getTransAccountLogsInSys(transAccountParamsDto,wpPage));
    }
}
